package com.travel.sight.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.travel.sight.entity.BrowseTimeEntity;
import com.travel.sight.service.BrowseTimeService;
import com.travel.common.utils.PageUtils;
import com.travel.common.utils.R;



/**
 * 
 *
 * @author lxw
 * @email lxw@gmail.com
 * @date 2023-11-01 17:41:24
 */
@RestController
@RequestMapping("sight/browsetime")
public class BrowseTimeController {
    @Autowired
    private BrowseTimeService browseTimeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("sight:browsetime:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = browseTimeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{browseId}")
    //@RequiresPermissions("sight:browsetime:info")
    public R info(@PathVariable("browseId") Integer browseId){
		BrowseTimeEntity browseTime = browseTimeService.getById(browseId);

        return R.ok().put("browseTime", browseTime);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("sight:browsetime:save")
    public R save(@RequestBody BrowseTimeEntity browseTime){
		browseTimeService.save(browseTime);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("sight:browsetime:update")
    public R update(@RequestBody BrowseTimeEntity browseTime){
		browseTimeService.updateById(browseTime);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("sight:browsetime:delete")
    public R delete(@RequestBody Integer[] browseIds){
		browseTimeService.removeByIds(Arrays.asList(browseIds));

        return R.ok();
    }

}
